<div id="Starting-a-new-project"></div>
<div class="header">
<p>
Next: [[cvs: Revisions#Revisions|Revisions]], Previous: [[cvs: The Repository#The Repository|Repository]], Up: [[cvs#Top|Top]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
<div id="Starting-a-project-with-CVS"></div>
== Starting a project with CVS ==
<div id="index-Starting-a-project-with-CVS"></div>
<div id="index-Creating-a-project"></div>

Because renaming files and moving them between
directories is somewhat inconvenient, the first thing
you do when you start a new project should be to think
through your file organization.  It is not impossible
to rename or move files, but it does increase the
potential for confusion and <small>CVS</small> does have some
quirks particularly in the area of renaming
directories.  See [[cvs: Adding, removing, and renaming files and directories#Moving and renaming files|Moving files]].

What to do next depends on the situation at hand.

<div class="menu-preformatted" style="font-family: serif">
 [[#Setting up the files|&bull; Setting up the files]]::        Getting the files into the repository
 [[#Defining the module|&bull; Defining the module]]::         How to make a module of the files
</div>


----

<div id="Setting-up-the-files"></div>
<div class="header">
<p>
Next: [[#Defining the module|Defining the module]], Up: [[#Starting a project with CVS|Starting a new project]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
<div id="Setting-up-the-files-1"></div>
=== Setting up the files ===

The first step is to create the files inside the repository.  This can
be done in a couple of different ways.

<div class="menu-preformatted" style="font-family: serif">
 [[#Creating a directory tree from a number of files|&bull; From files]]::                  This method is useful with old projects
                                 where files already exists.
 [[#Creating Files From Other Version Control Systems|&bull; From other version control systems]]::  Old projects where you want to
                                         preserve history from another system.
 [[#Creating a directory tree from scratch|&bull; From scratch]]::                Creating a directory tree from scratch.
</div>


----

<div id="From-files"></div>
<div class="header">
<p>
Next: [[#Creating Files From Other Version Control Systems|From other version control systems]], Up: [[#Setting up the files|Setting up the files]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
<div id="Creating-a-directory-tree-from-a-number-of-files"></div>
==== Creating a directory tree from a number of files ====
<div id="index-Importing-files"></div>

When you begin using <small>CVS</small>, you will probably already have several
projects that can be
put under <small>CVS</small> control.  In these cases the easiest way is to use the
<code>import</code> command.  An example is probably the easiest way to
explain how to use it.  If the files you want to install in
<small>CVS</small> reside in &lsquo;<tt><var>wdir</var></tt>&rsquo;, and you want them to appear in the
repository as &lsquo;<tt>$CVSROOT/yoyodyne/<var>rdir</var></tt>&rsquo;, you can do this:

<div class="example" style="margin-left: 3.2em">
 $ cd <var>wdir</var>
 $ cvs import -m &quot;Imported sources&quot; yoyodyne/<var>rdir</var> yoyo start
</div>

Unless you supply a log message with the &lsquo;<code>-m</code>&rsquo;
flag, <small>CVS</small> starts an editor and prompts for a
message.  The string &lsquo;<code>yoyo</code>&rsquo; is a <em>vendor tag</em>,
and &lsquo;<code>start</code>&rsquo; is a <em>release tag</em>.  They may fill
no purpose in this context, but since <small>CVS</small> requires
them they must be present.  See [[cvs: Tracking third-party sources#Tracking third-party sources|Tracking sources]], for
more information about them.

You can now verify that it worked, and remove your
original source directory.

<div class="example" style="margin-left: 3.2em">
 $ cd ..
 $ cvs checkout yoyodyne/<var>rdir</var>       # <span class="roman" style="font-family:serif; font-weight:normal">Explanation below</span>
 $ diff -r <var>wdir</var> yoyodyne/<var>rdir</var>
 $ rm -r <var>wdir</var>
</div>

Erasing the original sources is a good idea, to make sure that you do
not accidentally edit them in <var>wdir</var>, bypassing <small>CVS</small>.
Of course, it would be wise to make sure that you have
a backup of the sources before you remove them.

The <code>checkout</code> command can either take a module
name as argument (as it has done in all previous
examples) or a path name relative to <code>$CVSROOT</code>,
as it did in the example above.

It is a good idea to check that the permissions
<small>CVS</small> sets on the directories inside <code>$CVSROOT</code>
are reasonable, and that they belong to the proper
groups.  See [[cvs: The Repository#File permissions|File permissions]].

If some of the files you want to import are binary, you
may want to use the wrappers features to specify which
files are binary and which are not.  See [[cvs: Reference manual for Administrative files#The cvswrappers file|Wrappers]].


----

<div id="From-other-version-control-systems"></div>
<div class="header">
<p>
Next: [[#Creating a directory tree from scratch|From scratch]], Previous: [[#Creating a directory tree from a number of files|From files]], Up: [[#Setting up the files|Setting up the files]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
<div id="Creating-Files-From-Other-Version-Control-Systems"></div>
==== Creating Files From Other Version Control Systems ====
<div id="index-Importing-files_002c-from-other-version-control-systems"></div>

If you have a project which you are maintaining with
another version control system, such as <small>RCS</small>, you
may wish to put the files from that project into
<small>CVS</small>, and preserve the revision history of the
files.

<div id="index-RCS_002c-importing-files-from"></div>
;From RCS
: If you have been using <small>RCS</small>, find the <small>RCS</small> files&mdash;usually a file named &lsquo;<tt>foo.c</tt>&rsquo; will have its <small>RCS</small> file in &lsquo;<tt>RCS/foo.c,v</tt>&rsquo; (but it could be other places; consult the <small>RCS</small> documentation for details).  Then create the appropriate directories in <small>CVS</small> if they do not already exist.  Then copy the files into the appropriate directories in the <small>CVS</small> repository (the name in the repository must be the name of the source file with &lsquo;<code>,v</code>&rsquo; added; the files go directly in the appropriate directory of the repository, not in an &lsquo;<tt>RCS</tt>&rsquo; subdirectory).  This is one of the few times when it is a good idea to access the <small>CVS</small> repository directly, rather than using <small>CVS</small> commands.  Then you are ready to check out a new working directory.

: The <small>RCS</small> file should not be locked when you move it into <small>CVS</small>; if it is, <small>CVS</small> will have trouble letting you operate on it.

;From another version control system
: Many version control systems have the ability to export <small>RCS</small> files in the standard format.  If yours does, export the <small>RCS</small> files and then follow the above instructions.

: Failing that, probably your best bet is to write a script that will check out the files one revision at a time using the command line interface to the other system, and then check the revisions into <small>CVS</small>. The &lsquo;<tt>sccs2rcs</tt>&rsquo; script mentioned below may be a useful example to follow.

<div id="index-SCCS_002c-importing-files-from"></div>
;From SCCS
: There is a script in the &lsquo;<tt>contrib</tt>&rsquo; directory of the <small>CVS</small> source distribution called &lsquo;<tt>sccs2rcs</tt>&rsquo; which converts <small>SCCS</small> files to <small>RCS</small> files. Note: you must run it on a machine which has both <small>SCCS</small> and <small>RCS</small> installed, and like everything else in contrib it is unsupported (your mileage may vary).

<div id="index-PVCS_002c-importing-files-from"></div>
;From PVCS
: There is a script in the &lsquo;<tt>contrib</tt>&rsquo; directory of the <small>CVS</small> source distribution called &lsquo;<tt>pvcs_to_rcs</tt>&rsquo; which converts <small>PVCS</small> archives to <small>RCS</small> files. You must run it on a machine which has both <small>PVCS</small> and <small>RCS</small> installed, and like everything else in contrib it is unsupported (your mileage may vary).  See the comments in the script for details.


----

<div id="From-scratch"></div>
<div class="header">
<p>
Previous: [[#Creating Files From Other Version Control Systems|From other version control systems]], Up: [[#Setting up the files|Setting up the files]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
<div id="Creating-a-directory-tree-from-scratch"></div>
==== Creating a directory tree from scratch ====

For a new project, the easiest thing to do is probably
to create an empty directory structure, like this:

<div class="example" style="margin-left: 3.2em">
 $ mkdir tc
 $ mkdir tc/man
 $ mkdir tc/testing
</div>

After that, you use the <code>import</code> command to create
the corresponding (empty) directory structure inside
the repository:

<div class="example" style="margin-left: 3.2em">
 $ cd tc
 $ cvs import -m &quot;Created directory structure&quot; yoyodyne/<var>dir</var> yoyo start
</div>

Then, use <code>add</code> to add files (and new directories)
as they appear.

Check that the permissions <small>CVS</small> sets on the
directories inside <code>$CVSROOT</code> are reasonable.


----

<div id="Defining-the-module"></div>
<div class="header">
<p>
Previous: [[#Setting up the files|Setting up the files]], Up: [[#Starting a project with CVS|Starting a new project]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
<div id="Defining-the-module-1"></div>
=== Defining the module ===
<div id="index-Defining-a-module"></div>
<div id="index-Editing-the-modules-file"></div>
<div id="index-Module_002c-defining"></div>
<div id="index-Modules-file_002c-changing"></div>

The next step is to define the module in the
&lsquo;<tt>modules</tt>&rsquo; file.  This is not strictly necessary,
but modules can be convenient in grouping together
related files and directories.

In simple cases these steps are sufficient to define a module.


# Get a working copy of the modules file.

<div class="example" style="margin-left: 3.2em">
 $ cvs checkout CVSROOT/modules
 $ cd CVSROOT
</div>


# Edit the file and insert a line that defines the module.  See [[cvs: The Repository#The administrative files|Intro administrative files]], for an introduction.  See [[cvs: Reference manual for Administrative files#The modules file|modules]], for a full description of the modules file.  You can use the following line to define the module &lsquo;<code>tc</code>&rsquo;:

<div class="example" style="margin-left: 3.2em">
 tc   yoyodyne/tc
</div>


# Commit your changes to the modules file.

<div class="example" style="margin-left: 3.2em">
 $ cvs commit -m &quot;Added the tc module.&quot; modules
</div>


# Release the modules module.

<div class="example" style="margin-left: 3.2em">
 $ cd ..
 $ cvs release -d CVSROOT
</div>


----

<div class="header">
<p>
Previous: [[#Setting up the files|Setting up the files]], Up: [[#Starting a project with CVS|Starting a new project]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
This document was generated on <i>a sunny day</i> using [http://www.nongnu.org/texi2html/ <i>texi2html</i>].
